
//  MasterTableViewCell.swift
//  YueJian
//
//  Created by mac on 2017/11/11.
//  Copyright © 2017年 MapleStory. All rights reserved.
//

import UIKit

class MasterTableViewCell: UITableViewCell {

    @IBOutlet weak var love: UIButton!
    var num : String?
    @IBOutlet weak var number: UILabel!
    @IBOutlet weak var head: UIImageView!
    @IBOutlet weak var title: UILabel!
    override func awakeFromNib() {
        super.awakeFromNib()
        number.text = num ?? ""
        love.addTarget(self, action: #selector(change(btn:)), for: .touchUpInside)
        
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

    }
    @objc func change(btn:UIButton) {
        
        
        print(btn.isSelected)
        if btn.isSelected {
            
            let n = Int(num!)! - 1
            num = String(n)
            number.text = String(n)
            btn.isSelected = false
        } else {
            let n = Int(num!)! + 1
            num = String(n)
            number.text = String(n)
            btn.isSelected = true
        }
        
    }
    @IBAction func loveAction(_ sender: Any) {
    }
    
}
